package edu.java.homework.hw08.ipj09.exer01done;

public class RavnostranenTriangle {

    // --- Instance Variables --------------------------------------------------
    double side1 = 0.0d;

    // --- Constructors --------------------------------------------------------
    public RavnostranenTriangle() {
	side1 = 0.0d;
    }

    public RavnostranenTriangle(double side1) {
	this.side1 = side1;
    }

    // copy constructor
    public RavnostranenTriangle(RavnostranenTriangle ravnostranenTr) {
	this.setSide1(ravnostranenTr.getSide1());
    }

    // --- Getters and Setters -------------------------------------------------
    public double getSide1() {
	return side1;
    }

    public void setSide1(double side1) {
	this.side1 = side1;
    }

    // --- Methods -------------------------------------------------------------

    public double getPerimeter() {
	return 4 * getSide1();
    }

    public double getSurface() {
	return (Math.sqrt(3) / 4) * Math.pow(getSide1(), 2);
    }

    public void printPerimeterAndSurface() {
	System.out.printf("Perimeter: %.2f%n", getPerimeter());
	System.out.printf("Surface: %.2f%n", getSurface());
    }

    // --- Method Override -----------------------------------------------------

    @Override
    public String toString() {
	return "side1: " + getSide1();
    }
}
